import serve from './../Base/Http.js'
import qs from 'qs'
   // 数据列表
   export default {
    admin (data){
        return serve({
            method:'get',
            params:{
                _gp:"admin",
                _mt:"list",       
                ...data
              }
        })
    },
     //编辑
     compile(ruleForm){
        return serve({
            method:'post',
            data:qs.stringify({
                _gp:"admin",
                _mt:"update",
                adminDTO: JSON.stringify({
                  username: ruleForm.username,
                  password:ruleForm.password,
                  phone:ruleForm.phone,
                  realname:ruleForm.realname,
                  roleIds:ruleForm.roleIds,
                  id:ruleForm.id,
                })
              })
        }) 
    },
    // 添加
    addition(ruleForm){
      return serve({
          method:'post',
          data:qs.stringify({
              _gp:"admin",
              _mt:"create",
              adminDTO: JSON.stringify({
                username:ruleForm.username,
                password:ruleForm.password,
                phone:ruleForm.phone,
                realname:ruleForm.realname,
                roleIds:ruleForm.roleIds
              })
            })
      }) 
  },
  //删除
  handleDelete (data){
    return serve({
        method:'post',
        params:{
            _gp:"admin",
            _mt:"delete",
            ...data
          }
    })
}
}